files=brightness.sh psscript.sh psscript-services.sh rotate.sh runinx.sh
add_files = powermanager/pm.out fujitsu-tablet/fujitsu-tablet.ko
dirs=powermanager fujitsu-tablet
ALL: $(add_files)

powermanager/pm.out: force_look
	cd powermanager; $(MAKE) $(MFLAGS)

fujitsu-tablet/fujitsu-tablet.ko: force_look
	cd fujitsu-tablet; $(MAKE) $(MFLAGS)
	
install: $(files) $(add_files)
	for i in $(files); do install $$i /usr/local/bin/$$i; done
#	for i in $(dirs); do cd $$i; $(MAKE) $(MFLAGS) $@; cd ..; done
#	mv /usr/lib/modules/$(shell uname -r)/kernel/drivers/platform/x86/fujitsu-tablet.ko.gz /usr/lib/modules/$(shell uname -r)/kernel/drivers/platform/x86/fujitsu-tablet.ko.gz.sav || true

uninstall:
	for i in $(files) pm.out; do rm /usr/local/bin/$$i; done || true
	for i in $(dirs); do cd $$i; $(MAKE) $(MFLAGS) $@; cd ..; done || true

clean:
	for i in $(dirs); do cd $$i; $(MAKE) $(MFLAGS) $@; cd ..; done

force_look:
	true
